package fy.mdm.operator;

import com.seeyon.v3x.services.flow.bean.FlowExport;
import com.seeyon.v3x.services.form.bean.ValueExport;

import fy.form.listen.operate.AForm_Save_Operator;
import fy.form.listen.operate.IFormOperator;
import fy.mdm.bean.NewCustomerCodeBean;
import fy.mdm.dao.NewCustomerCodeDao;

public class NewCustomerCodeOperator extends AForm_Save_Operator implements IFormOperator{
	private NewCustomerCodeBean bean=new NewCustomerCodeBean();
	@Override
	public String getFormName() {
		// TODO Auto-generated method stub
		return "新增客户编码";
	}

	@Override
	protected void parseOtherField_FirstStep(FlowExport flowExport) {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected void parseValueExport(ValueExport ve) {
		// TODO Auto-generated method stub
		String fieldName = ve.getDisplayName();
		if ("客户编码".equals(fieldName)) {
			bean.setCustomerCode(ve.getValue());
		} else if ("客户全称".equals(fieldName)) {
			bean.setCustomerName(ve.getValue());
		} else if ("申请日期".equals(fieldName)) {
			bean.setCreatetime(ve.getValue());
		} else if ("客户类型".equals(fieldName)) {
			bean.setCustomerstype(ve.getValue());
		} else if ("申请人工号".equals(fieldName)) {
			bean.setCreator(ve.getValue());
		} else if ("客户国别".equals(fieldName)) {
			bean.setCountry(ve.getValue());
		} else if ("会计工号".equals(fieldName)) {
			bean.setApprover(ve.getValue());
		} else if ("审批日期".equals(fieldName)) {
			bean.setApprovertime(ve.getValue());
		} 
	}

	@Override
	protected boolean save() {
		// TODO Auto-generated method stub
		try {
			NewCustomerCodeDao NewCustomerCodeDao =new NewCustomerCodeDao();
			NewCustomerCodeDao.setNewCustomerCodeBean(bean);		
			return NewCustomerCodeDao.getStateReturn();
		} catch (Exception e) {
			// TODO: handle exception
		}finally {
			//bean.clear();
			bean = null;
		}
	return success;

	}

}
